﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace RSPJ.Windows
{
    public partial class SelectMultiFiles : Form
    {
        public List<int> selectedIndex;
        public SelectMultiFiles()
        {
            InitializeComponent();
        }

        private void SelectMultiFiles_Shown(object sender, EventArgs e)
        {
            for (int i = 0; i < GlobalData.fileList.Count; i++)
            {
                lbxFile.Items.Add(GlobalData.fileList[i].Name);
            }
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            selectedIndex = new List<int>();
            int j = lbxFile.SelectedItems.Count;
            for(int i = 0; i < j; i++)
            {
                selectedIndex.Add(lbxFile.SelectedIndices[i]);
            }
            if (selectedIndex.Count == 0)
            {
                MessageBox.Show("请选择文件!");
            }
            else
            {
                DialogResult = DialogResult.OK;
                Close();
            }
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            Close();
        }
    }
}
